<?php $this->_extends('_layouts/basic_layout'); ?>

<?php $this->_block('resource'); ?>

<?php $this->_endblock(); ?>

<?php $this->_block('title'); ?>
	Fonts
<?php $this->_endblock(); ?>

<?php $this->_block('admin_contents'); ?>

<div id="content" class="box">
	<h1>添加字体</h1>
	
	<div id="menu" class="box">
		<ul class="box">
			<li><a href="<?php echo url('fonts/index');?>"><span>返回列表</span></a></li>
		</ul>
	</div>
	
	<fieldset>
		<legend>编写</legend>
		
		<ul class="formErrors">
			<?php $formErrors = $fonts->getValidateError(); if(!empty($formErrors)): ?>
				<?php foreach($formErrors as $item => $errors): ?>
					<li>
						<?php echo $item; ?>
						<ul>
							<?php foreach($errors as $error): ?>
								<li class="error"><?php echo $error; ?></li>
							<?php endforeach; ?>
						</ul>
					</li>
				<?php endforeach; ?>
			<?php endif; ?>
		</ul>
		<form id="font-addform" enctype="multipart/form-data" method="post" action="<?php echo url('fonts/add'); ?>">
			<table class="nostyle">
				<tr>
					<th style="width: 10%;"></th>
					<th style="width: 90%;"></th>
				</tr>
				<tr>
					<td>字体名称:</td>
					<td><input type="text" class="input-text" name="form[name]" /></td>
				</tr>
				<tr>
					<td>默认预览字符串:</td>
					<td><input type="text" class="input-text" name="form[default_preview_string]" /></td>
				</tr>
				<tr>
					<td>文件存放根目录名称:</td>
					<td><input type="text" class="input-text" name="form[root_foldername]" /></td>
				</tr>
				<tr>
					<td>概述:</td>
					<td><input type="text" class="input-text" name="form[sketch]" /></td>
				</tr>
				<tr>
					<td>用途分类:</td>
					<td>
						<select id="type_using" class="typesexist" name="form[type_using_id]">
							<?php if(!empty($fonts_type['type_using'])): ?>
								<?php foreach($fonts_type['type_using'] as $k => $t): ?>
									<option value="<?php echo $t['id'] ?>"><?php echo $t['name']; ?></option>
								<?php endforeach; ?>
							<?php endif; ?>
						</select>
					</td>
				</tr>
				<tr>
					<td>区域分类:</td>
					<td>
						<select id="type_area" class="typesexist" name="form[type_area_id]">
							<?php if(!empty($fonts_type['type_area'])): ?>
								<?php foreach($fonts_type['type_area'] as $k => $t): ?>
									<option value="<?php echo $t['id'] ?>"><?php echo $t['name']; ?></option>
								<?php endforeach; ?>
							<?php endif; ?>
						</select>
					</td>
				</tr>
				<tr>
					<td>特点分类:</td>
					<td>
						<select id="type_feature" class="typesexist" name="form[type_feature_id]">
							<?php if(!empty($fonts_type['type_feature'])): ?>
								<?php foreach($fonts_type['type_feature'] as $k => $t): ?>
									<option value="<?php echo $t['id'] ?>"><?php echo $t['name']; ?></option>
								<?php endforeach; ?>
							<?php endif; ?>
						</select>
					</td>
				</tr>
				<tr class="attach-line">
					<td>仅字体文件:</td>
					<td>
						<input type="file" class="input-text" name="form[font_file]" />
					</td>
				</tr>
				<tr>
					<td>下载包:</td>
					<td><input type="file" class="input-text" name="form[download_pack]" /></td>
				</tr>
				<tr>
					<td><input type="submit" class="input-submit" value="添加"/></td>
				</tr>
			</table>

		</form>
	</fieldset>
</div>

<script>
	var formInitModel = new FormInit(<?php echo json_encode($fonts->attributes); ?>);
	formInitModel.setFormGroup('form');
	formInitModel.transverArrtoForm();
</script>
<?php $this->_endblock(); ?>